import { createRouter, createWebHashHistory } from 'vue-router';
const routes = [
    {
        path: '/',
        component: () => import('../view/home.vue'),
        //在根目录下切换路由
        children: [
            // 用户列表
            {
                path: 'users',
                name: 'users',
                component: () => import('../view/users.vue'),
            },
        ]
    },
    {
        path: '/login',
        component: () => import('../view/login.vue')
    },
    {
        path: '/home',
        component: () => import('../view/home.vue')
    },
];
const router = createRouter({
    //路由的模式是哈希模式
    history: createWebHashHistory(),
    routes
});

//导航守卫，守卫home，如果有储存数据就进入，如果没有就不进入

//导出
export default router